
//
//  JKExt_image.swift
//  Fanrengame
//
//  Created by 朱凯 on 2018/4/3.
//  Copyright © 2018年 JooKey. All rights reserved.
//

import Foundation
import UIKit

extension UIImage {
    
    func image(withColor color: UIColor) -> UIImage? {
        let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
        UIGraphicsBeginImageContextWithOptions(rect.size, false, 0)
        color.setFill()
        UIRectFill(rect)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        return image
    }
}
